<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Car_analyze extends AdminController{
    public $_validation = null;

    function __construct()
    {
        parent::__construct();
        $this->load->model('MCar');
    }

    public function index()
    {
        $this->load->library('FormFilter');
        $this->load->helper('formfilter');
        $total = $this->MCar->getAllData();
        $this->assign('total',$total);
        $this->layout('car.tpl');
    }

    function ajaxPieData(){
        $this->load->library('FormFilter');
        $this->load->helper('formfilter');
        $group = ['闲置中','使用中','已损坏','维修中'];
        $data = $this->MCar->getPieData($group);
        exit(json_encode([
            'success' => 1,
            'msg' => '获取成功',
            'data' => [
                'group' => $group,
                'data'  => $data
            ]
        ]));
    }
}
